package room_event

import (
	"github.com/spf13/cast"
	timCache "longmen/server/internal/rpc/tencentim/cache"
	"longmen/server/internal/rpc/tencentim/chat"
	messages2 "longmen/server/internal/rpc/tencentim/messages"
	"longmen/server/internal/rpc/tencentim/utils"
	pb "longmen/server/pkg/protobuf"
)

/*
返回修改后的礼物消息
*/
func handlingGiftFeedMessage(user *chat.ClientUser, groupId int, b []byte) (ret *pb.CallbackResp, err error) {
	ret = &pb.CallbackResp{}
	ret.ErrorCode = 0
	msg := timCache.GetGiftReplyQue(user.UserId) //把要给用户回复的消息拿出来
	if msg == nil || len(*msg.Data) == 0 {
		return utils.CallbackFailResp(msg, cast.ToString(groupId)), nil
	}
	timCache.DelGiftReplyQue(user.UserId)
	msg.SentMessageStruct = messages2.SentMessageStruct{Type: messages2.GiftFeedReplyMessageType}
	return utils.CallbackOkAndExt(msg, cast.ToString(groupId)), nil
}
